//
//  ACTViewController.m
//  HomeIn
//
//  Created by 张涛 on 15/11/8.
//  Copyright © 2015年 ZZP. All rights reserved.
//

#import "ACTViewController.h"

#import "ACTModel.h"

@interface ACTViewController ()<UITableViewDataSource,UITableViewDelegate,UIWebViewDelegate>
@property(nonatomic,strong)NSMutableArray *allArray;
@property(nonatomic,strong)UITableView *actTableView;
@property(nonatomic,assign)NSInteger currenPage;
@property(nonatomic,assign)BOOL isUpLoading;
@property(nonatomic,strong)MBProgressHUD *hud;
@property(nonatomic,strong)UIWebView *ACTWebView;
@end

@implementation ACTViewController

-(void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = [UIColor wheatColor];
    self.ACTWebView = [[UIWebView alloc]initWithFrame:[[UIScreen mainScreen]bounds]];
    self.ACTWebView.delegate = self;
    [self.view addSubview:self.ACTWebView];
    [self addTabBar];
    [self AFNWorking];
    
}
-(void)addTabBar
{
    //自定义UINavigationBar的标题
    UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(50*WIDTHSCALE, 0, 150*WIDTHSCALE, 44*HEIGHTSCALE)];
    titleLabel.text = @"家居分类";
    titleLabel.textColor = [UIColor black25PercentColor];
    titleLabel.textAlignment = NSTextAlignmentCenter;
    titleLabel.font = [UIFont fontWithName:@"Arial" size:20];
    self.navigationItem.titleView = titleLabel;
    
    
}
-(void)AFNWorking
{
NSString *url_string = [NSString stringWithFormat:@"http://api.bohejiaju.com/v1/posts/%ld",self.ID];
    [BlockGetAFNYiBu GetAfnURLWithString:url_string resultBlock:^(id result)
    {
        NSMutableDictionary *bigDic  = (NSMutableDictionary *)result;
        NSMutableDictionary *dic = [bigDic objectForKey:@"data"];
        ACTModel *model = [[ACTModel alloc]init];
        model.content_html = [dic objectForKey:@"content_html"];
        [self.ACTWebView loadHTMLString:model.content_html baseURL:nil];
        
    } errorBlcok:^(NSError *error)
    {
        
        
    }];
}



- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
